import request from '@/utils/request'

export function getNormalGoodList(params) {
  return request({
    url: 'back/shop/commodityList',
    method: 'get',
    params
  })
}

export function getGoodDetail(data) {
  return request({
    url: 'back/shop/commodityAdd?type=amend',
    method: 'post',
    data
  })
}

export function editGoodFour(data) {
  return request({
    url: 'back/shop/commodityAdd?type=four',
    method: 'post',
    data
  })
}

export function editGoodGetParamsOne(data) {
  return request({
    url: '/back/shop/commodityAdd?type=one',
    method: 'get'
  })
}

export function editGoodGetParamsTwo(params) {
  return request({
    url: 'back/shop/commodityAdd?type=two',
    method: 'get',
    params
  })
}

export function editGoodOne(data) {
  return request({
    url: 'back/shop/commodityAdd?type=one',
    method: 'post',
    data
  })
}

export function editGoodTwo(data) {
  return request({
    url: 'back/shop/commodityAdd?type=two',
    method: 'post',
    data
  })
}

export function editGoodThree(data) {
  return request({
    url: 'back/shop/commodityAdd?type=three',
    method: 'post',
    data
  })
}

export function goodPutaway(params) {
  return request({
    url: 'back/shop/commodityList?type=putaway',
    method: 'get',
    params
  })
}

export function getGoodClassList(params) {
  return request({
    url: 'back/shop/commodityKind?type=list',
    method: 'get'
  })
}

export function setClassHome(data) {
  return request({
    url: 'back/shop/commodityKind?type=home',
    method: 'post',
    data
  })
}

export function setClassSort(data) {
  return request({
    url: 'back/shop/commodityKind?type=sort',
    method: 'post',
    data
  })
}

export function getAddClassData(data) {
  return request({
    url: 'back/shop/commodityKind?type=add',
    method: 'get'
  })
}

export function addClass(data) {
  return request({
    url: 'back/shop/commodityKind?type=kind',
    method: 'post',
    data
  })
}

export function deleteClass(data) {
  return request({
    url: 'back/shop/commodityKind?type=delete',
    method: 'post',
    data
  })
}

export function getPropClassList(data) {
  return request({
    url: 'back/shop/commodityKindSpec?type=getKindAll',
    method: 'get'
  })
}

export function getPropList(params) {
  return request({
    url: 'back/shop/commodityKindSpec?type=list',
    method: 'get',
    params
  })
}

export function getPropDetail(params) {
  return request({
    url: 'back/shop/commodityKindSpec?type=setKind',
    method: 'get',
    params
  })
}

export function addProp(data) {
  return request({
    url: 'back/shop/commodityKindSpec?type=change',
    method: 'post',
    data
  })
}

export function deleteProp(data) {
  return request({
    url: 'back/shop/commodityKindSpec?type=deleteKind',
    method: 'post',
    data
  })
}

export function getBrandList(params) {
  return request({
    url: 'back/shop/commodityBrand?type=list',
    method: 'get'
  })
}

export function setBrandSort(data) {
  return request({
    url: 'back/shop/commodityBrand?type=change',
    method: 'post',
    data
  })
}

export function addBrand(data) {
  return request({
    url: 'back/shop/commodityBrand?type=change',
    method: 'post',
    data
  })
}

export function getInventoryList(data) {
  return request({
    url: 'back/shop/commodityRecord?type=list',
    method: 'post',
    data
  })
}

export function getGoodDetailOne(params) {
  return request({
    url: 'back/shop/commodityAdd?type=oneSave',
    method: 'get',
    params
  })
}

export function getGoodDetailThree(params) {
  return request({
    url: 'back/shop/commodityAdd?type=threeSave',
    method: 'get',
    params
  })
}

export function editGoodDetailOne(data) {
  return request({
    url: 'back/shop/commodityAdd?type=oneSave',
    method: 'post',
    data
  })
}

export function editGoodDetailThree(data) {
  return request({
    url: 'back/shop/commodityAdd?type=threeSave',
    method: 'post',
    data
  })
}

export function inventoryIn(data) {
  return request({
    url: 'back/shop/commodityRecord?type=add',
    method: 'post',
    data
  })
}

export function inventoryOut(data) {
  return request({
    url: 'back/shop/commodityRecord?type=minus',
    method: 'post',
    data
  })
}

export function getInventorySpec(data) {
  return request({
    url: 'back/shop/commodityRecord?type=getSpec',
    method: 'post',
    data
  })
}

export function getInventoryDetail(data) {
  return request({
    url: 'back/shop/commodityRecord?type=record',
    method: 'post',
    data
  })
}

export function getCommentList(params) {
  return request({
    url: 'back/shop/commodityEvalute?type=list',
    method: 'get',
    params
  })
}

export function showComment(params) {
  return request({
    url: 'back/shop/commodityEvalute?type=conceal',
    method: 'get',
    params
  })
}

export function commentReply(params) {
  return request({
    url: 'back/shop/commodityEvalute?type=reply',
    method: 'get',
    params
  })
}

export function deleteBrand(data) {
  return request({
    url: 'back/shop/commodityBrand?type=delete',
    method: 'post',
    data
  })
}

export function goodDelete(data) {
  return request({
    url: 'back/shop/commodityAdd?type=delete',
    method: 'post',
    data
  })
}

export function searchGoodsList(params) {
  return request({
    url: 'back/shop/commodityList?type=link',
    method: 'get',
    params
  })
}
/** ********************************************************************** */
export function getSpecificationList(id) {
  return request({
    url: '/back/shop/commodityAdd',
    method: 'get',
    params: { type: 'twos', id }
  })
}
// 价格规格
export function priceSpecification({ id, spec }) {
  return request({
    url: '/back/shop/commodityAdd',
    method: 'post',
    data: { type: 'two', id, spec }
  })
}
export function saveStepTwo({ id, spec_id, spec }) {
  return request({
    url: '/back/shop/commodityAdd',
    method: 'post',
    data: { id, spec_id, spec, type: 'saveTwo' }
  })
}
// 上一步编辑属性规格
export function editProperty(id) {
  return request({
    url: '/back/shop/commodityAdd',
    method: 'post',
    data: { type: 'editTwo', id }
  })
}
export function sendCommentDetail({ id, putaway, introduce }) {
  return request({
    url: '/back/shop/commodityAdd',
    method: 'post',
    data: { id, putaway, introduce, type: 'threes' }
  })
}
export function getCommentDetail(id) {
  return request({
    url: '/back/shop/commodityAdd',
    method: 'post',
    data: { type: 'amend', id }
  })
}
